
# 定义函数，实现 通用 断言功能 --- resp：形式参数
def common_assert(resp, status_code, success, code, message):
    assert status_code == resp.status_code
    assert success is resp.json().get("success")
    assert code == resp.json().get("code")
    assert message in resp.json().get("message")
    
    # assert 200 == resp.status_code
    # assert True is resp.json().get("success")
    # assert 10000 == resp.json().get("code")
    # assert "操作成功" in resp.json().get("message")

# 登录成功 --- common_assert(resp, 200, True, 10000, "操作成功")
# 密码错误 --- common_assert(resp, 200, False, 20001, "用户名或密码错误")
# 无参 --- common_assert(resp, 200, False, 99999, "抱歉，系统繁忙，请稍后重试！")

